﻿@model LoginModel
@using Nop.Web.Models.Customer;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Core.Infrastructure.DependencyManagement;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Login").Text);
    
    //register URL with return URL (if specified)
    var registerUrl = Url.RouteUrl("Register");
    if (!String.IsNullOrEmpty(this.Context.Request.QueryString["returnUrl"]))
    {
        var webHelper = EngineContext.Current.Resolve<IWebHelper>();
        registerUrl = webHelper.ModifyQueryString(registerUrl, "returnurl=" + HttpUtility.UrlEncode(this.Context.Request.QueryString["returnUrl"]), null);
    }
}
<div class="page login-page">
    <div class="page-title">
        @*<h1>T("Account.Login.Welcome")</h1>*@
    </div>
    @Html.Partial("_ExternalAuthentication.AssociateMessage")

    @Html.Partial("_ExternalAuthentication.Errors")

    <div class="page-body">
        <div class="login-block">
        @if (Model.CheckoutAsGuest)
        {
            @T("Account.Login.CheckoutAsGuestOrRegister")

                        @Html.Action("TopicBlock", "Topic", new { systemName = "CheckoutAsGuestOrRegister" })

                        <input type="button" class="button-1 checkout-as-guest-button" onclick="location.href='@Url.RouteUrl("Checkout")'" value="@T("Account.Login.CheckoutAsGuest")" />
                        <input type="button" class="button-1 register-button" onclick="location.href='@registerUrl'" value="@T("Account.Register")" />
        }

        @*T("Account.Login.ReturningCustomer")*@
        <h2>SpotsHUB Member Login</h2>
                @using (Html.BeginForm())
                {
                        @Html.ValidationSummary(true, T("Account.Login.Unsuccessful").Text)

                    if (Model.UsernamesEnabled)
                    {
                        <div class="login-input-username">
                        @Html.LabelFor(m => m.Username) <br />
                        @Html.TextBoxFor(m => m.Username, new { @class = "username", autofocus = "autofocus" })
                        @Html.ValidationMessageFor(m => m.Username)
                        </div>
                    }
                    else
                    {
                        <div class="login-input-username">
                        @Html.LabelFor(m => m.Email) <br />
                        @Html.TextBoxFor(m => m.Email, new { @class = "email" , autofocus = "autofocus"})
                        @Html.ValidationMessageFor(m => m.Email)
                        </div>
                    }
                        <div class="login-input-password">
                        @Html.LabelFor(m => m.Password) <br />
                        @Html.PasswordFor(m => m.Password, new { @class = "password" })
                        @Html.ValidationMessageFor(m => m.Password)
                        </div>
                        <div class="login-forgot-password">
                        @Html.RouteLink(T("Account.Login.ForgotPassword").Text, "PasswordRecovery")
                        </div>
                        <div class="login-remember">
                        @Html.CheckBoxFor(m => m.RememberMe)
                        @Html.LabelFor(m => m.RememberMe)
                        
                        </div>
                    if (Model.DisplayCaptcha)
                    {
                        @Html.Raw(Html.GenerateCaptcha())
                    }
                    <div class="externalauthentication">
                        @Html.Action("ExternalMethods", "ExternalAuthentication")
                    </div>
                    <input class="login-button button-red" type="submit" value="@T("Account.Login.LoginButton")" /> 
                }

        
        <div class="clear">
        </div>
        @*Html.Action("TopicBlock", "Topic", new { systemName = "LoginRegistrationInfo" })*@
        </div>
        <div class="register-block">
            @if (!Model.CheckoutAsGuest)
        {
                @*
            @T("Account.Login.NewCustomer")
                        @T("Account.Login.NewCustomerText")
              *@
               <div>Do not have an account? Sign up today to gain full access to SpotsHUB shipping services!</div>
               <input type="button" class="button-1 register-button button-grey" onclick="location.href='@registerUrl    '" value="@T("Account.Register")" />

        }
        </div>
        <div class="content-clear"></div>
    </div>
</div>
